package com.rentao.custom.mybatis;

/**
 * <p>SqlSession .
 *
 * <p>change history:
 *
 * <pre>
 * date         defect       person          comments
 * --------------------------------------------------------------------------------
 * 2025/6/29    ********     Tao Ren    create file.
 * </pre>
 *
 * @author Tao Ren
 * @date 2025/6/29 21:47
 */
public class SqlSession {

    private MyConfiguration configuration;

    private MyExecutor executor;

    public SqlSession(MyConfiguration configuration, MyExecutor executor) {
        this.configuration = configuration;
        this.executor = executor;
    }

    public <T> T getMapper(Class<?> aclass){
        return configuration.getMapper(aclass,this);
    }

    /**
     *
     * @param statement  sql语句
     * @param parameter  sql 参数
     * @param <T>
     * @return
     */
    public <T> T selectOne(String statement,String parameter){
        return executor.query(statement,parameter);
    }
}

